export const namespace = "contentToast";
import { Image, Space } from "antd";

export const calcColumns = (params) => {
  const { operate, venueArr } = params;
  // let enumlist = {};
  // venueArr.forEach((v) => {
  //   enumlist[v.id] = {
  //     text: v.venueName,
  //   };
  // });
  const columns = [
    {
      title: "ID",
      hidden: process.env.UMI_ENV == "prod" ? true : false,
      width: 180,
      dataIndex: "id",
      hideInSearch: true,
    },
    {
      title: "弹窗名称",
      dataIndex: "popupName",
    },
    {
      title: "展示图",
      dataIndex: "displayDrawUrl",
      hideInSearch: true,
      render: (_, record) => {
        return (
          <Space>
            {record.displayDrawUrl ? (
              <Image height={50} src={record.displayDrawUrl} />
            ) : null}
          </Space>
        );
      },
    },
    // {
    //   title: '点击量',
    //   dataIndex: 'date',
    //   hideInSearch: true
    // },
    {
      title: "指向类型",
      dataIndex: "pointType",
      hideInSearch: true,
      valueEnum: {
        1: { text: "课程" },
        2: { text: "教练" },
        3: { text: "自定义" },
      },
    },
    // {
    //   dataIndex: "venueId",
    //   title: "所属场馆",
    //   valueEnum: enumlist,
    //   hideInSearch: true,
    // },
    // {
    //   title: '更新人',
    //   dataIndex: 'updateBy',
    //   hideInSearch: true

    // },
    // {
    //   title: '更新时间',
    //   dataIndex: 'updateTime',
    //   hideInSearch: true
    // },

    {
      title: "上架状态",
      dataIndex: "status",
      valueEnum: {
        0: { text: "已上架", status: "Success" },
        1: { text: "已下架", status: "Default" },
      },
    },
    // {
    //   title: "排序",
    //   dataIndex: "displaySort",
    //   hideInSearch: true,
    // },
  ];
  if (params?.operate) {
    columns.push(params?.operate);
  }
  return columns;
};
